﻿using System;
using System.Collections.Generic;
using System.Configuration;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using OgilvyOne.BLL;
using System.Data;

public partial class allergy_lore_article_content : System.Web.UI.Page
{
    protected string classId;
    protected string columnId;
    protected string pid;
    protected string pename;
    protected string sename;

    protected string bannerpid;
    protected string bannerpename;
    protected string bannersename;

    protected string morepid;
    protected string morepename;
    protected string moresename;

    protected string titles;
    protected string meta_kwords;
    protected string meta_desc;

    protected string checkseo;
    protected string h1name;

    protected string DomainName;

    protected void Page_Load(object sender, EventArgs e)
    {
        DomainName = ConfigurationSettings.AppSettings["DomainName"];

        classId = Request["classId"];
        columnId = Request["columnId"];
        string artId = Request["artId"];
        if (classId == "196" && columnId=="196" && artId=="77")
        {
            h1name = "食物过敏";
        }
        if (classId == "196" && columnId == "197" && artId == "146")
        {
            h1name = "过敏体质";
        }
        if (classId == "196" && columnId == "198" && artId == "117")
        {
            h1name = "牛奶过敏";
        }
        if (classId == "196" && columnId == "198" && artId == "52")
        {
            h1name = "过敏性湿疹-婴儿湿疹";
        }
        if (classId == "196" && columnId == "199" && artId == "70")
        {
            h1name = "容易过敏";
        }
        if (classId == "196" && columnId == "199" && artId == "148")
        {
            h1name = "宝宝吃鸡蛋过敏";
        }
        if (classId == "196" && columnId == "199" && artId == "81")
        {
            h1name = "食物过敏症状";
        }
        if (classId == "196" && columnId == "199" && artId == "35")
        {
            h1name = "过敏症状";
        }
        if (classId == "196" && columnId == "199" && artId == "147")
        {
            h1name = "过敏性哮喘";
        }
        if (classId == "196" && columnId == "198" && artId == "118")
        {
            h1name = "过敏性皮炎";
        }

        DataTable checkdt=BLLArticleInfo.selArticle(artId);
        foreach(DataRow row in checkdt.Rows)
        {
            checkseo = row["isstaticpub"].ToString();
            if (checkseo == "1")
            {
                titles = row["ARTICLETITLE"].ToString();
                meta_kwords = row["ARTICLEKEYWORD"].ToString();
                meta_desc = row["ARTICLEDESC"].ToString();
            }
            else
            {
                DataTable seodt = BLLArticleInfo.getSeoInfo(columnId);
                foreach (DataRow seorow in seodt.Rows)
                {
                    titles = seorow["Columntitle"].ToString();
                    meta_kwords = seorow["ColumnKeyword"].ToString();
                    meta_desc = seorow["ColumnDesc"].ToString();
                }
            }

        }

        if (columnId != "180")
        {

            //导航
            //1级栏目名
            DataTable dtclass = BLLArticleInfo.getColumnName(classId);
            this.classNm_rpt.DataSource = dtclass;
            this.classNm_rpt.DataBind();
            if (columnId != "196")
            {
                //2级栏目名
                DataTable dtcolumn = BLLArticleInfo.getColumnName(columnId);
                this.columnName_rpt.DataSource = dtcolumn;
                this.columnName_rpt.DataBind();
            }

        }
        ////文章名称
        DataTable dtArticleNm = BLLArticleInfo.GetArticleContent(columnId, artId);
        this.AticleName_rpt.DataSource = dtArticleNm;
        this.AticleName_rpt.DataBind();
        //文章内容
        DataTable dtc = BLLArticleInfo.GetArticleContent(columnId, artId);
        this.content_rpt.DataSource = dtc;
        this.content_rpt.DataBind();
        //妈妈要知道
        DataTable knowdt = BLLArticleInfo.selectc("5", "doKnow", "1");
        //研究
        this.yanjiu_rpt.DataSource = BLLArticleInfo.selArticle("85");
        this.yanjiu_rpt.DataBind();

        //foreach(DataRow row in knowdt.Rows)
        //{
        //    string cid = row["COLUMNID"].ToString();
        //    DataTable senamedt = BLLArticleInfo.getEname(cid);
        //    foreach(DataRow row1 in senamedt.Rows)
        //    {
        //        sename = row1["ECLASSNAME"].ToString();
        //    }
        //    DataTable piddt = BLLArticleInfo.getpid(cid);
        //    foreach (DataRow row1 in piddt.Rows)
        //    {
        //        pid = row1["PARENTID"].ToString();
        //        if (pid == "196")
        //        {
        //            pename = "lore";
        //        }
        //        else if (pid == "204")
        //        {
        //            pename = "plan";
        //        }
        //        else if (pid == "205")
        //        {
        //            pename = "doctor";
        //        }
        //        else if (pid == "179" && cid == "204")
        //        {
        //            pename = "plan";
        //        }

        //        else if (pid == "179" && cid == "196")
        //        {
        //            pename = "lore";
        //        }
        //        else if (pid == "179" && cid == "180")
        //        {
        //            pename = "index";
        //        }
        //    }
        //}
        this.doKnow_rpt.DataSource = knowdt;
        this.doKnow_rpt.DataBind();
        //banner 你知道吗
        DataTable bannerdt = BLLArticleInfo.selectc("isbanner", "1");
        //foreach (DataRow row in bannerdt.Rows)
        //{
        //    string bannercid = row["COLUMNID"].ToString();
        //    DataTable bannerpiddt = BLLArticleInfo.getpid(bannercid);
        //    foreach (DataRow row1 in bannerpiddt.Rows)
        //    {
        //        bannerpid = row1["PARENTID"].ToString();
        //        bannersename = row1["ECLASSNAME"].ToString();
        //        if (bannerpid == "196")
        //        {
        //            bannerpename = "lore";
        //        }
        //        else if (bannerpid == "204")
        //        {
        //            bannerpename = "plan";
        //        }
        //        else if (bannerpid == "205")
        //        {
        //            bannerpename = "doctor";
        //        }
        //        else if (bannerpid == "179" && bannercid == "204")
        //        {
        //            bannerpename = "plan";
        //        }

        //        else if (bannerpid == "179" && bannercid == "196")
        //        {
        //            pename = "lore";
        //        }
        //        else if (bannerpid == "179" && bannercid == "180")
        //        {
        //            bannerpename = "index";
        //        }
        //    }
        //}

        this.banner_rpt.DataSource = bannerdt;
        this.banner_rpt.DataBind();

        //更多文章推荐
        DataTable dtr = BLLArticleInfo.GetRecommend(columnId);
        //foreach (DataRow row in dtr.Rows)
        //{
        //    string morecid = row["COLUMNID"].ToString();
        //    DataTable morepiddt = BLLArticleInfo.getpid(morecid);
        //    foreach (DataRow row1 in morepiddt.Rows)
        //    {
        //        morepid = row1["PARENTID"].ToString();
        //        moresename = row1["ECLASSNAME"].ToString();
        //        if (morepid == "196")
        //        {
        //            morepename = "lore";
        //        }
        //        else if (morepid == "204")
        //        {
        //            morepename = "plan";
        //        }
        //        else if (pid == "205")
        //        {
        //            morepename = "doctor";
        //        }
        //        else if (morepid == "179" && morecid == "204")
        //        {
        //            morepename = "plan";
        //        }

        //        else if (morepid == "179" && morecid == "196")
        //        {
        //            morepename = "lore";
        //        }
        //        else if (morepid == "179" && morecid == "180")
        //        {
        //            morepename = "index";
        //        }
        //    }
        //}

        this.Recommend.DataSource = dtr;
        this.Recommend.DataBind();

    }
}
